package com.kingdee.eas.mx.log.vs.app;

import org.apache.log4j.Logger;
import javax.ejb.*;
import java.rmi.RemoteException;
import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK;
//import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
//import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;

import java.lang.String;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.mx.basedata.master.CargoListNumberFactory;
import com.kingdee.eas.mx.basedata.master.CargoListNumberInfo;
import com.kingdee.eas.mx.log.vs.WrittenOffSingleCollection;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.eas.framework.ObjectBaseCollection;
import com.kingdee.eas.framework.Result;
import com.kingdee.eas.mx.log.vs.WrittenOffSingleInfo;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.eas.framework.app.DataBaseControllerBean;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.framework.DataBaseCollection;

public class WrittenOffSingleControllerBean extends AbstractWrittenOffSingleControllerBean
{
	private static Logger logger =
		Logger.getLogger("com.kingdee.eas.mx.log.vs.app.WrittenOffSingleControllerBean");

	//	protected IObjectPK _save(Context ctx, IObjectValue model)
//	throws BOSException, EASBizException {
//		WrittenOffSingleInfo wosInfo = (WrittenOffSingleInfo)model;
//		CargoListNumberInfo clnInfo = CargoListNumberFactory.getLocalInstance(ctx).getCargoListNumberInfo(new ObjectUuidPK(wosInfo.getYNumber().getId().toString()));
//		String sql = "update T_CL_CargoList set FVerNumber='"+wosInfo.getNumber()+"' where Fnumber='"+clnInfo.getNumber()+"'";
//		DbUtil.execute(ctx, sql);
//		return super._save(ctx, model);
//	}

	protected IObjectPK _submit(Context ctx, IObjectValue model)
			throws BOSException, EASBizException {
		WrittenOffSingleInfo wosInfo = (WrittenOffSingleInfo)model;
		CargoListNumberInfo clnInfo = CargoListNumberFactory.getLocalInstance(ctx).getCargoListNumberInfo(new ObjectUuidPK(wosInfo.getYNumber().getId().toString()));
		String sql = "update T_CL_CargoList set FVerNumber='"+wosInfo.getNumber()+"' where Fnumber='"+clnInfo.getNumber()+"'";
		DbUtil.execute(ctx, sql);
		return super._submit(ctx, model);
	}
	
	
	
}